package n1129;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	
	static boolean status[][] =new boolean[26][26];
	
	static int[] result=new int[26];
	
	static int max;
	
	static boolean flag=false;
	
	static void dfs(int m,int count)
	{
		//System.out.println(m+" "+ count);
		if(m==max||flag) {
			if(!flag)
			{
				System.out.println(count+" channel"+(count>1?"s":"")+" needed.");
				flag=true;
			}
			return;
		}else {
			boolean stop=false;
			for(int i=0;i<count;i++)
			{
				if(isok(m,i))
				{
					stop=true;
					result[m]=i;
					dfs(m+1,count);
					result[m]=-1;
					break;
				}
			}
			if(stop==false)
			{
				result[m]=count;
				dfs(m+1,count+1);
				result[m]=-1;
			}
		}
	}
	static boolean isok(int m,int count)
	{
		for(int i=0;i<m;i++)
		{
			if(status[m][i]==true&&result[i]==count)return false;
		}
		return true;
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception{

		BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
		String line=null;
		while((line=bf.readLine())!=null)
		{
			max=Integer.parseInt(line);
			flag=false;
			if(max==0)break;
			for(int i=0;i<max;i++)
				for(int j=0;j<max;j++)
					status[i][j]=false;
			for(int i=0;i<max;i++)result[i]=-1;
			for(int i=0;i<max;i++)
			{
				line=bf.readLine();
				for(int j=2;j<line.length();j++)
				{
					status[i][line.charAt(j)-'A']=true;
				}
			}
			dfs(0,1);
		}
		
	}

}
